#!/usr/bin/bash
#%# family=manual
#%# capabilities=autoconf

PATH=/opt/local/bin:${PATH}
log=/var/log/clamav/clamd.log

if [ "$1" = "autoconf" ]; then
        if [ -r $log ]; then 
            echo "yes"
        else
            echo "no (cannot read $log)"
        fi
        exit 0
fi

if [ "$1" = "config" ]; then

    cat <<EOT
graph_title ClamAV stats
graph_args --base 1000 -l 0 
graph_vlabel virus/day
graph_category Mail
virus.label virus
virus.type DERIVE
virus.min 0
virus.draw AREA
virus.cdef virus,86400,*
EOT
        exit 0
fi

echo -n "virus.value " && fgrep -c FOUND $log
exit 0
